import React from 'react'
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
import Login from './pages/Login'
import Layout from './pages/Layout'
import './App.scss'

function App() {
  return (
    <Router>
      <div className='app'>
        <Route
          path='/'
          exact
          render={() => {
            // render中可以写逻辑
            // 目前只写了返回重定向
            return <Redirect to='/home' />
          }}
        ></Route>
        <Route path='/login'>
          <Login />
        </Route>
        <Route path='/home'>
          <Layout />
        </Route>
      </div>
    </Router>
  )
}

export default App
